java中sortedset

您所在的位置:网站首页 redis size java中sortedset

java中sortedset

2023-04-20 12:24| 来源: 网络整理| 查看: 265

SortedSet是个接口,它里面的(只有TreeSet这一个实现可用)中的元素一定是有序的。

声明的主要接口

Public Methods

abstract

Comparator super E>

comparator()

Returns the comparator used to compare elements in this

SortedSet.

返回与此有序集合关联的比较器,如果使用元素的自然顺序,则返回 null。

abstract E

first()

Returns the first element in this

SortedSet.

返回此有序集合中当前第一个(最小的)元素。

abstract

SortedSet

headSet(E end)

Returns a

SortedSet of the specified portion of this

SortedSet which contains elements less than the end element.

用一个SortedSet, 返回此有序集合中小于end的所有元素。

abstract E

last()

Returns the last element in this

SortedSet.

返回此有序集合中最后一个(最大的)元素

abstract

SortedSet

subSet(E start, E end)

Returns a

SortedSet of the specified portion of this

SortedSet which contains elements greater or equal to the start element but less than the end element.

返回此有序集合的部分元素,元素范围从 fromElement(包括)到 toElement(

不包括)。

abstract

SortedSet

tailSet(E start)

Returns a

SortedSet of the specified portion of this

SortedSet which contains elements greater or equal to the start element.

返回此有序集合的部分元素,其元素

大于或等于 fromElement。

注意:

1

:SortedSet意思是“根据对象的比较顺序”,而不是“插入顺序”进行排序.

2

:关于SortedSet的更多信息请参阅下面的它唯一实现类TreeSet。

3:关于SortedSe截取子串的时候,to都不包含,from包含



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3